package com.wangle.base.agent.jdk.code;

import lombok.AllArgsConstructor;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 切面类（实现InvocationHandler）
 */
@AllArgsConstructor
public class ServiceHandler implements InvocationHandler {

    private Object target;

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("前置环绕");
        Object invoke = method.invoke(target, args);
        System.out.println("后置环绕");
        return invoke;

    }
}
